package org.bt.common.convert;

import ma.glasnost.orika.MapperFacade;
import org.bt.common.convertor.ListConvertor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Bean对象转换处理器
 *
 * @author zwj
 */
@Component
public class BeanLsConvertor<T, K> implements ListConvertor<T, K> {

    @Autowired
    private MapperFacade mapperFacade;

    @Override
    public List<K> convert(Iterable<T> iterable, Class<K> aClass) {
        return mapperFacade.mapAsList(iterable, aClass);
    }
}
